{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# How to install and manage dependencies\n",
        "\n",
        "LangGraph.js is part of the [LangChain](https://js.langchain.com/) ecosystem,\n",
        "which includes the primary\n",
        "[`langchain`](https://www.npmjs.com/package/langchain) package as well as\n",
        "packages that contain integrations with individual third-party providers. They\n",
        "can be as specific as\n",
        "[`@langchain/anthropic`](https://www.npmjs.com/package/@langchain/anthropic),\n",
        "which contains integrations just for Anthropic chat models, or as broad as\n",
        "[`@langchain/community`](https://www.npmjs.com/package/@langchain/community),\n",
        "which contains broader variety of community contributed integrations.\n",
        "\n",
        "These packages, as well as LangGraph.js itself, all rely on\n",
        "[`@langchain/core`](https://www.npmjs.com/package/@langchain/core), which\n",
        "contains the base abstractions that these packages extend.\n",
        "\n",
        "To ensure that all integrations and their types interact with each other\n",
        "properly, it is important that they all use the same version of\n",
        "`@langchain/core`. When installing LangGraph, you should install `@langchain/core` alongside it as well:\n",
        "\n",
        "```bash\n",
        "$ npm install @langchain/langgraph @langchain/core\n",
        "```\n",
        "\n",
        "`@langchain/core` must be installed separately because it is a peer dependency of `@langchain/langgraph`.\n",
        "This is to help package managers resolve a single version of `@langchain/core`.\n",
        "\n",
        "Despite this, in some situations, your package manager may resolve multiple versions of core, which can result in unexpected TypeScript errors or other strange behavior. If you need to guarantee that you only have one version of `@langchain/core` is to add a `\"resolutions\"` or\n",
        "`\"overrides\"` field in your project's `package.json`. The specific field name will depend on your package manager. Here are a few examples:\n",
        "\n",
        "<div class=\"admonition tip\">\n",
        "  <p class=\"admonition-title\">Tip</p>\n",
        "  <p>\n",
        "    The <code>resolutions</code> or <code>pnpm.overrides</code> fields for <code>yarn</code> or <code>pnpm</code> must be set in the root <code>package.json</code> file.\n",
        "\n",
        "    Also note that we specify EXACT versions for resolutions.\n",
        "  </p>\n",
        "</div>\n",
        "\n",
        "If you are using `yarn`, you should set [`\"resolutions\"`](https://yarnpkg.com/cli/set/resolution):\n",
        "\n",
        "```json\n",
        "{\n",
        "  \"name\": \"your-project\",\n",
        "  \"version\": \"0.0.0\",\n",
        "  \"private\": true,\n",
        "  \"engines\": {\n",
        "    \"node\": \">=18\"\n",
        "  },\n",
        "  \"dependencies\": {\n",
        "    \"@langchain/anthropic\": \"^0.2.15\",\n",
        "    \"@langchain/langgraph\": \"^0.2.0\"\n",
        "  },\n",
        "  \"resolutions\": {\n",
        "    \"@langchain/core\": \"0.2.31\"\n",
        "  }\n",
        "}\n",
        "```\n",
        "\n",
        "For `npm`, use [`\"overrides\"`](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#overrides):\n",
        "\n",
        "```json\n",
        "{\n",
        "  \"name\": \"your-project\",\n",
        "  \"version\": \"0.0.0\",\n",
        "  \"private\": true,\n",
        "  \"engines\": {\n",
        "    \"node\": \">=18\"\n",
        "  },\n",
        "  \"dependencies\": {\n",
        "    \"@langchain/anthropic\": \"^0.2.15\",\n",
        "    \"@langchain/langgraph\": \"^0.2.0\"\n",
        "  },\n",
        "  \"overrides\": {\n",
        "    \"@langchain/core\": \"0.2.31\"\n",
        "  }\n",
        "}\n",
        "```\n",
        "\n",
        "For `pnpm`, use the nested [`\"pnpm.overrides\"`](https://pnpm.io/package_json#pnpmoverrides) field:\n",
        "\n",
        "```json\n",
        "{\n",
        "  \"name\": \"your-project\",\n",
        "  \"version\": \"0.0.0\",\n",
        "  \"private\": true,\n",
        "  \"engines\": {\n",
        "    \"node\": \">=18\"\n",
        "  },\n",
        "  \"dependencies\": {\n",
        "    \"@langchain/anthropic\": \"^0.2.15\",\n",
        "    \"@langchain/langgraph\": \"^0.2.0\"\n",
        "  },\n",
        "  \"pnpm\": {\n",
        "    \"overrides\": {\n",
        "      \"@langchain/core\": \"0.2.31\"\n",
        "    }\n",
        "  }\n",
        "}\n",
        "```\n",
        "\n",
        "## Next steps\n",
        "\n",
        "You've now learned about some special considerations around using LangGraph.js\n",
        "with other LangChain ecosystem packages.\n",
        "\n",
        "Next, check out [some how-to guides on core functionality](/langgraphjs/how-tos/#core)."
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Deno",
      "language": "typescript",
      "name": "deno"
    },
    "language_info": {
      "name": "typescript"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 2
}
